def sort():
    show()
    if os.path.exists(filename):
        with open(filename,'r') as rfile:
            student_old = rfile.readlines()
            student_new = []
            for list in student_old:
                student_new.append(dict(eval(list)))
    else:
        return
    ascORdesc = input("请选择(0升序;1降序): ")
    if ascORdesc == "0":
        ascORdescBool = False
    elif ascORdesc == "1":
        ascORdescBool = True
    else:
        print("输入错误，请重新数据")
        sort()
    mode = input("请选择排序方式(1按英语成绩排序;2按python成绩排序;0按总成绩排序):")
    if mode == "1":
        student_new.sort(key=lambda x:x["english"],reverse=ascORdescBool)
    elif mode == "2":
        student_new.sort(key=lambda x:x["python"],reverse=ascORdescBool)
    elif mode == "0":
        student_new.sort(key=lambda x:x["english"]+x["python"],reverse=ascORdescBool)
    else:
        print("输入错误，请重新输入")
        sort()
    show_student(student_new)